﻿

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data
Imports System.Data.SqlClient



Public Class FmDSHH
    Public conn4 As SqlConnection



    Private Sub FormDSHH_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim sql4 As String

        Try
            conn4 = New SqlConnection
            Me.conn4.ConnectionString = "data Source=.;Initial Catalog=MUABANMAYTINH;Integrated Security=True"
            'Dim conn4 As SqlConnection = New SqlConnection(CONSTR)
            conn4.Open()

            sql4 = "SELECT  MAHANG,TENHANG,DGIAI,DVT,TGianBH from HANGHOA "

            Dim da As New SqlDataAdapter(sql4, conn4)

            Dim ds As New DataSet

            Dim rp As ReportDocument
            rp = New CrystalReport1
            ds.Tables.Clear()
            da.Fill(ds)
            rp.SetDataSource(ds.Tables(0))
            Me.CrystalReportViewer1.ReportSource = rp



            Me.CrystalReportViewer1.Zoom(100)
            Me.CrystalReportViewer1.Refresh()

            ' Cursor = Cursors.Default
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class